title: MapSnapshotter: Overlays & Annotations description: MapSnapshotter.take now draws polyline/polygon/circle overlays and pin annotations onto the image, with automatic framing — turn a MapDirections route into a picture in one call.
MapSnapshotter renders a static map image offscreen via MapKit. Useful when
you need a map picture without a live <Map> view — widget previews,
share-sheet thumbnails, exported reports, or any place SwiftUI's Map isn't
available.
take — render a snapshot
Options
MapSnapshot
Overlay coordinates
point is the snapshotter's escape hatch for drawing pins or labels on top of
the image:
Working with the UIImage
snap.image exposes the same UIImage instance returned by other APIs, so
all the existing helpers work — for example, downscale before sharing:
Overlays & annotations
Pass overlays and annotations to bake geographic content directly into the
image — no manual coordinate math or extra <Image> layering. This is the easy
way to turn a route into a picture.
When you omit both region and camera, the snapshot auto-fits every
overlay and annotation, so a route becomes a one-liner:
Overlays
Each overlay is one of three shapes. Colors accept any Color string
("#RRGGBB", "rgb(...)", "systemBlue", …).
Annotations
A marker is a pin whose tip points at coordinate. Add an optional glyph
(an SF Symbol name, or up to two characters of text) and a title caption.
Overlays and annotations are drawn after the base map, in array order, with annotations always on top. Anything projecting outside the frame is simply clipped.
Notes
- A 1024×768 retina PNG can be a few megabytes; reach for
preparingThumbnailbefore persisting if the snapshot is only used as a preview. - Apple caps
scalearound 3x on most devices; values above are silently clamped. - Network-backed (Apple's map tile service) — failures resolve through the Promise rejection with the underlying error message.
